/**
 * @typedef ConfigBody
 * @property {string} siteName
 * @property {string} recordNo
 * @property {string} copyright
 * @property {string} version
 * @property {string} siteLogo
 * @property {string} smtpHost
 * @property {string} smtpPort
 * @property {string} smtpUsername
 * @property {string} smtpPassword
 * @property {string} smtpSendEmail
 */

const express = require('express')
const router = express.Router()
const auth = require('@/middleware/auth.middleware')
const utilsController = require('@/controllers/utils.controller')

/**
 * 配置信息查询
 * @route GET /query/config
 * @summary 配置信息查询
 * @group 其他
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access system-config-permission:btn:find
 * @security JWT
 */
router.get('/query/config', auth(), utilsController.findConfig)

/**
 * 配置信息更新
 * @route PUT /set/config
 * @summary 配置信息查询
 * @group 其他
 * @param {ConfigBody.model} ConfigBody.body.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access system-config-permission:btn:edit
 * @security JWT
 */
router.put('/set/config', auth(), utilsController.updateConfig)

module.exports = router
